package com.ww.basic.fun

object EquipmentUseNotDry extends App {
  // 一步步进行优化
//  val equipment1 = new Equipment(
//    { input => println(s"calc with $input"); input }
//  )
//  val equipment2 = new Equipment(
//    { input => println(s"calc with $input"); input }
//  )

//  val calculator = { input: Int => println(s"calc with $input"); input }

  def calculator(input: Int) = { println(s"calc with $input"); input }

  val equipment1 = new Equipment(calculator)
  val equipment2 = new Equipment(calculator)

  equipment1.simulate(4)
  equipment2.simulate(6)
}